package com.yuewen.permissioncheck.asm.checker;

/**
 * Imei
 *
 * @author zhanglulu
 */
public class GetImeiPermission extends BasePermission {
  @Override
  boolean check(InvokeParam param) {
    if ("getImei".equals(param.methodName)
      && "()Ljava/lang/String;".equals(param.methodDesc)
      && "android/telephony/TelephonyManager".equals(param.methodOwnClass)) {
      return true;
    }
    //反射获取
    if ("getMethod".equals(param.methodName)
      && "(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;".equals(param.methodDesc)
      && "getImei".equals(param.methodParam)
      && "java/lang/Class".equals(param.methodOwnClass)) {
      return true;
    }
    return false;
  }

  @Override
  String invokeHookMethodName() {
    return "invokeGetImei";
  }
}
